import { createRouter, createWebHashHistory } from "vue-router";
import Layout from "../views/Layout/Layout.vue";
import shareInfo from "./wx";
const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: "/",
            name: "layout",
            component: Layout,
            children: [
                {
                    path: "index",
                    component: () => import("../views/Index/Index.vue"),
                },
                {
                    path: "awardsList",
                    component: () =>
                        import("../views/AwardsList/AwardsList.vue"),
                },
                {
                    path: "subAwardsList/:type",
                    component: () =>
                        import("../views/SubAwardsList/SubAwardsList.vue"),
                },
                {
                    path: "awardsDetail/:id",
                    component: () =>
                        import("../views/AwardsDetail/AwardsDetail.vue"),
                },
            ],
        },
    ],
});

router.afterEach(() => {
    if (import.meta.env.MODE == "production") {
        shareInfo.init({
            title: "重磅发布 | 2023第十五届中国猎车榜奖项揭晓",
            desc: "NBD汽车（微信号：NBD-AUTO）",
            img: "http://www.nbd.com.cn/corp/20231115liechebang-m/share.png",
            shareURL: "http://www.nbd.com.cn/corp/20231115liechebang-m/#/index",
        });
    }
});

export default router;
